#pragma once

class View;
class Layout;
class SkCanvas;

class Cell
{
public:
	Cell(unsigned int xInHundred);
	Cell();
	virtual ~Cell();

	enum Type
	{
		TYPE_NOTSET, // not set
		TYPE_VIEW,   // view
		TYPE_LAYOUT  // layout
	};

	// if return 0, means it is fixed Cell.
	virtual unsigned int GetxInHundred() { return m_xInHundred; }
	virtual void SetxInHundred(unsigned int xInHundred) { m_xInHundred = xInHundred; }

	virtual void SetView(View* view);
	virtual void SetLayout(Layout* layout);
	virtual bool GetViewOrLayout(void*& viewOrLayout, enum Type& type);

	virtual void setX(unsigned int x) { m_x = x; }
	virtual void setY(unsigned int y) { m_y = y; }
	virtual void setWidth(unsigned int width) { m_width = width; }
	virtual void setHeight(unsigned int height) { m_height = height; }

	virtual unsigned int X() { return m_x; }
	virtual unsigned int Y() { return m_y; }
	virtual unsigned int Width() { return m_width; }
	virtual unsigned int height() { return m_height; }

	void updateLayout();

	bool onPaint(SkCanvas* pCanvas);

	virtual bool isFixSize() { return false;  }

private:
	void* m_ViewOrLayout; // View or Layout
	enum Type m_type;

	unsigned int m_xInHundred;

	unsigned int m_x;
	unsigned int m_y;
	unsigned int m_width;
	unsigned int m_height;

	unsigned int m_id;

	unsigned int m_leftOrRightPad;
	bool m_padisLeft;
	unsigned int m_topOrBottomPad;
	bool m_padisTop;
};

